Regression: confidence interval and prediction interval
With 20 points and a residual standard deviation of 1 (the spread of the points around the line), the predicted mean at the center is known to ±0.47 (confidence interval), but a new observation only to ±2.15 (prediction interval). You know which interval answers which question.
A course experiment whose values are computed within the stated model and are not research findings: The chapter: summary, formulas and FAQ (slides in French) · All experiments · Glossary: prediction interval.
Testing the line
Before building an interval around the line, check that the slope is significant: the Student t test on the slope, with an extreme point, and r, R² and centring the data.
Try it and interpret
At the center of the scatter, compare the half-widths (distance from the center to the edge of the band), 0.47 and 2.15. Increase n (the number of points): the band for the mean narrows clearly, the band for an observation much less. Move x₀ (the x value where you predict) beyond the observed values: both widen and the extrapolation warning appears.
Why is the interval for a new observation wider than the interval for the mean?
The confidence interval concerns the mean of y at x₀: it contains only the uncertainty of the line and narrows as n increases. The prediction interval adds the spread of an individual observation, which does not vanish, even with a lot of data.
Show the formulas
Confidence interval of the mean. For the prediction interval of a new observation, add 1 under the root.
Where: ŷ₀ is the value predicted by the line at x₀, t the Student quantile with n − 2 degrees of freedom for 95%, sₑ the residual standard deviation (spread of points around the line), n the number of points, x̄ the mean of x and Sxx = Σ(xᵢ − x̄)².
Definitions
- Confidence interval
- It brackets the mean of y at x₀.
- Prediction interval
- It brackets a new observation at x₀: add 1 under the root.
- x₀, ŷ₀
- The value where the prediction is made and the mean predicted by the line.
- x̄, n, Sxx
- The mean of the observed x, their number and the sum of squared deviations x − x̄.
- sₑ (se)
- The estimated residual standard deviation: the spread of points around the line.
- t
- The Student quantile for a 95% band, with n − 2 degrees of freedom. See the Student test.
Assumptions and limitations
Simple regression, independent normal errors of constant variance, constructed scatter. Bands hold at 95% at each x, not over the whole curve at once. In extrapolation, the model may be wrong without the band showing it.
Go further
- The course chapter: summary with the formulas, conditions of the test and FAQ in English; slides in French
- The influential point: what one point does to the line
- Correlation and R²: the share of variation described by the line
- The normal distribution: where “about 2 standard deviations” comes from
- Evaluating a forecast: persistence as a reference
Cite this page
Voyant, C. (2026). Regression: confidence interval and prediction interval. www.cyrilvoyant.com. https://doi.org/10.5281/zenodo.24136645. https://www.cyrilvoyant.com/tools/regression-intervals/. CC BY 4.0.
BibTeX entry, cited in a LaTeX document with \cite{voyant2026_regressionintervals} (package url or hyperref):
@misc{voyant2026_regressionintervals,
author = {Voyant, Cyril},
title = {{Regression: confidence interval and prediction interval}},
year = {2026},
howpublished = {www.cyrilvoyant.com},
doi = {10.5281/zenodo.24136645},
url = {https://www.cyrilvoyant.com/tools/regression-intervals/},
note = {Accessed [date]}
}Course archive (all versions) · Biostatistics course (10.5281/zenodo.23620235).
See the difference between confidence and prediction intervals on solar data. Probabilistic solar forecasting.